# 自定义异常类
class WupeiqiException(Exception):
    def __init__(self, msg):
        self.message = msg
    def __str__(self):
        return self.message

# raise: 主动触发异常
try:
    raise WupeiqiException('自定义异常描述')  # 构建一个异常类实例
except WupeiqiException as e:
    print(e)